// *********** Simple Client ****************//

#ifndef _CLIENT_HPP_
#define _CLIENT_HPP_

#include <iostream>
#include <thread>
#include <cstdlib>
#include <deque>

#include <asio/impl/src.hpp>
#include <asio.hpp>

#include "Message.hpp"


using asio::ip::tcp;

typedef std::deque<Message> MessageQueue;

class Client
{
    public:
    Client(asio::io_context&, const tcp::resolver::results_type&);
    void write(const Message&);
    void close();
    private:
    void DoConnet(const tcp::resolver::results_type&);
    void DoReadHead();
    void DoReadBody();
    void DoWrite();

    private:
    asio::io_context& m_io_Context;
    tcp::socket m_socket;
    Message m_CurrentMessage;
    MessageQueue m_ChatContext;
};

#endif //_CLIENT_HPP_